<?php

class ErweitertesichtbarkeitenController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }

    public function letztefreundeAction()
    {
    	$auth = Zend_Auth::getInstance();
		if ($auth->hasIdentity()) {
			$userid = $auth->getIdentity()->id;
			$mapper = new Application_Model_Mapper_AuthMapper();
			$user = $mapper->fetchID($userid);
			$friends = $mapper->fetchactivefriends($userid);

			$this->view->friends = $friends;
	    	$this->view->user = $user;
		
		}
    }

    public function letztenachrichtenAction()
    {
    	$mapperLastMessage = new Application_Model_Mapper_LastmessageMapper();
		
		$auth = Zend_Auth::getInstance();
		if ($auth->hasIdentity()) {
			$userid = $auth->getIdentity()->id;
			$nachrichten = $mapperLastMessage->fetchUserID($userid);
			$mapper = new Application_Model_Mapper_AuthMapper();
			$user = $mapper->fetchID($userid);		

			$this->view->nachrichten = $nachrichten;
			$this->view->user = $user;
		}
    }

    public function letztebesucheAction()
    {
    	$mapperLastvisited = new Application_Model_Mapper_LastvisitedMapper();
		
		$auth = Zend_Auth::getInstance();
		if ($auth->hasIdentity()) {
			$userid = $auth->getIdentity()->id;
			$besuche = $mapperLastvisited->fetchUserID($userid);
			
			$userid = $auth->getIdentity()->id;
			$mapper = new Application_Model_Mapper_AuthMapper();
			$user = $mapper->fetchID($userid);		

			$this->view->besuche = $besuche;
			$this->view->user = $user;
			
			}
    }


}







